package tcu.yuyp;

import java.util.List;
import java.util.stream.Collectors;

public class MovieLister {
    MovieFinder finder;

    public MovieLister(MovieFinder finder){
        this.finder = finder;
    }

    //用于返回指定导演的所有电影的名字
    public List<String> movieNameDirectedBy(String director){
        return finder.findAll().stream()
                .filter(movie -> movie.isDirectedBy(director))
                .map(Movie::getName)
                .collect(Collectors.toList());
    }

}
